//
//  QCRoundCell.m
//  Hyatt
//
//  Created by QC.L on 15/5/26.
//  Copyright (c) 2015年 QC.L. All rights reserved.
//

#import "QCRoundCell.h"
#import "UIImageView+WebCache.h"

@interface QCRoundCell ()
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIImageView *backImageView;

@end

@implementation QCRoundCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        self.imageView.image = [UIImage imageNamed:@"zhanweitu"];
        [self.contentView addSubview:self.imageView];
        [_imageView release];
        
        self.backImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"小图蒙板"]];
        self.backImageView.frame = CGRectMake(0, self.imageView.frame.size.height - 30, self.contentView.frame.size.width, 30);
        self.backImageView.alpha = 0;
        [self.imageView addSubview:self.backImageView];
        [_backImageView release];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, self.contentView.frame.size.width - 20, 30)];
        self.titleLabel.textColor = [UIColor whiteColor];
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        [self.backImageView addSubview:self.titleLabel];
        [_titleLabel release];

    }
    return self;
}

- (void)setImageUrl:(NSString *)imageurl
{
    _imageUrl = [imageurl copy];
    if ([_imageUrl hasPrefix:@"http://"] || [_imageUrl hasPrefix:@"ftp://"]) {
        [self.imageView sd_setImageWithURL:[NSURL URLWithString:_imageUrl] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
        self.backImageView.alpha = 1;
    } else {
        self.imageView.image = [UIImage imageNamed:imageurl];
    }
}



@end
